n = int(input())
l = list(map(int, input().split()))
dp = []
maxl = 0
# 用dp存前n条边的和，判断现价进来的是否为最大的一条边
if n > 2:
    dp = [l[0], l[0]+l[1]]
    maxl = max(l[0],l[1])
i = 2
flag = False
while i < n:
    if l[i] > maxl:
        if dp[-1] > l[i]:
            print(i+1)
            flag = True
            break
    else:
        if dp[-1] + l[i] > maxl:
            print(i + 1)
            flag = True
            break
    dp.append(dp[-1]+l[i])
    i += 1
if not flag:
    print(-1)
